home *** CD-ROM | disk | FTP | other *** search
- Path: qns2.qns.com!not-for-mail
- From: mjarvis@qns2.qns.com (Michael Jarvis)
- Newsgroups: comp.lang.c
- Subject: Re: EOF error
- Date: 31 Jan 1996 23:03:33 -0600
- Organization: Questar Network Services
- Message-ID: <4ephj5$74a@qns2.qns.com>
- References: <4eo12b$om3@newsbf02.news.aol.com>
- X-Newsreader: TIN [version 1.2 PL2]
-
- Polver (Polver (polver@aol.com)) wrote:
- > Why doesn't the following work.
- > I'm using a unix system at school.
-
- > #include <stdio.h>
-
- > main()
- > {
- > int c;
-
- > c = getchar();
- > while (c != EOF) {
- > putchar(c);
- > c = getchar(c);
- Getchar doesn't take a parameter. This should be c=getchar()
-
- > }
- > }
-
- > I keep getting an error about EOF undefined ar not scalar or something.
-
- I don't know what system you're using. Other than the getchar(c) mistake
- this code should work. According to secion 7.9.1 of the ANSI/ISO
- 9899-1990 C standard, the stdio.h file should define the EOF macro,
- "...which expands to a negative integral constant expression that is
- returned by several functions to indicate end-of-file, that is, no more
- input from a stream..."
-
- -michael
- --
- Michael Jarvis | Finger for PGP Public key | QNSnet Technical Support
- mjarvis@qns.com | http://www.qns.com/~mjarvis | Questar Network Services
- GC3.1: GCS d s+++: a26 C++++ USLV++++$ P++++ L++ E--- W++ N++ !o K+ W-- !O
- M- !V PS+ PE Y+ PGP+ t+ 5 X R tv b+++ DI+++ D++ G+ e>++ h---(*) r+++ y+++
-